<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="/my/sharkcms/public/bootstrap/css/bootstrap.css" rel="stylesheet" type="text/css" />
<link href="/my/sharkcms/Public/home/css/style.css" rel="stylesheet" type="text/css" />
<link href="/my/sharkcms/Public/home/css/uc.css" rel="stylesheet" type="text/css" />
<script src="/my/sharkcms/Public/js/jquery.js"></script>
<script src="/my/sharkcms/Public/bootstrap/js/bootstrap.min.js"></script>
<title><?php echo __SYSTEMNAME__; echo ($pageconfig["tittle"]); ?></title>
<script>
$(document).ready(function(){
   $('.outlogin').click(function(){                   
      var url="<?php echo U('Public/outlogin');?>";
      $.post(url,function(data){
	     $(".logininfor").html('<a href="<?php echo U("Index/login");?>" style=" color:#B61D1D;">&nbsp;您好，&nbsp;&nbsp;请登录</a>&nbsp;&nbsp;<a href="<?php echo U("Index/reg");?>">免费注册</a>');
	  });
	  return false;
   });
});
</script>
</head>

<body>
<script>
   $(document).ready(function(){
      $(".h_hover_li").hover(function(){
	      $(this).css({"border":"1px solid #ddd","background":"#fff","borderBottom":"0px"});
		  $(this).find("b").css({"backgroundPosition":"-90px -43px"});
		  $(this).next().css({"visibility":"visible"});
	  },function(){
	      $(this).css({"border":"1px solid #fff","background":"none"});
		  $(this).find("b").css({"backgroundPosition":"-90px -53px"});
		  $(this).next().css({"visibility":"hidden"});
	  });
	  $(".h_hover_extend").hover(function(){
	      $(this).prev().css({"border":"1px solid #ddd","background":"#fff","borderBottom":"0px"});
		  $(this).prev().find("b").css({"backgroundPosition":"-90px -43px"});
		  $(this).css({"visibility":"visible"});
	  },function(){
	      $(this).prev().css({"border":"1px solid #fff","background":"none","borderBottom":"0px"});
		  $(this).prev().find("b").css({"backgroundPosition":"-90px -53px"});
		  $(this).css({"visibility":"hidden"});
	  });
   });
</script>

     <div class="reg_line1" align="center">
	    <div class="reg_line1_main">
		    <div class="fl reg_line1_main_l"> <b class="regbg"></b>收藏<?php echo __SYSTEMNAME__;?></div>
			<div class="fr reg_line1_main_r">
			    <ul>
				   <li class="logininfor">
			            <?php if(session('uid')): ?><a href="__GROUP__/Uc/index.html" class="loginname"><?php echo getUserName(session('uid'));?></a>&nbsp;&nbsp;<a href="#" class="outlogin">[退出]</a>
			               <?php else: ?>
			                  <a href="<?php echo U('Index/login');?>" style=" color:#B61D1D;">&nbsp;您好，&nbsp;&nbsp;请登录</a>&nbsp;&nbsp;<a href="<?php echo U('Index/reg');?>">免费注册</a><?php endif; ?>
				   </li>
				   <li><s></s><a href="#" class="heightgray">我的订单</a></li>
				   <li><s></s><a href="#" class="heightgray">手机<?php echo __SYSTEMNAME__;?></a></li>
				   <li>
				       <s></s><div class="fl h_hover_li"><a href="#" class="heightgray fl">客户服务</a><b></b></div>
					   <div class="h_hover_extend" >
					         <a href="#">常见问题</a><br /><a href="#">售后服务</a><br /><a href="#">在线客服</a>
					         <br /><a href="#">投诉中心</a><br /><a href="#">客服邮箱</a>
					   </div>
					</li>
				</ul>  
			</div>
		</div>
	 </div>





<div class="h10"></div>

<div align="center">
  <div class="cartcontent">
    <div class="cart_head">
      <div id="cartlogo" class="fl"><a href="/my/sharkcms/index.php"><img src="/my/sharkcms/Public/home/images/logo.png" /></a></div>
      <div class="clear"></div>
      <div class="f20 fyahei shop_order_ht">填写并核对订单信息</div>
<!--订单块的开始-->	
        <script src="/my/sharkcms/Public/js/ad.js"></script>
	
    <form method="post" name="order" action="<?php echo U('Index/order_submit');?>" >	
    <input name="order_submit" type="hidden" value="1"/>  
      <div class="shop_order">

        <div class="shop_wap1">
          <div class="shop_wap1_text"> 收货地址</div>
          <div class="btn btn-default btn-sm" style="margin-left:20px;" data-toggle="modal" 
   data-target="#myModal" id="add">新增收货地址</div>
          <div class="shop_wap1_text_main">
                <ul>
                    <?php if(is_array($address)): $k = 0; $__LIST__ = $address;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$adr): $mod = ($k % 2 );++$k;?><li>
                            <input id="check<?php echo ($k); ?>" name="address" type="radio" <?php if($k == 1): ?>checked<?php endif; ?> value="<?php echo ($k-1); ?>">
                            <label for="check<?php echo ($k); ?>">
                            <?php echo getAdName($adr['area'][0]);?>
                            <?php echo getAdName($adr['area'][1]);?>
                            <?php echo getAdName($adr['area'][2]);?>
                            <?php echo ($adr['address']); ?>&nbsp;&nbsp;
                            <?php echo ($adr['receiver']); ?>（收）&nbsp;&nbsp;
                            <?php echo ($adr['mobile']); ?>&nbsp;&nbsp;
                            <?php echo ($adr['email']); ?>
                            </label>
                        </li><?php endforeach; endif; else: echo "" ;endif; ?>
                </ul>
			      
            <div class="clear"></div>
          </div>
        </div>
		
        
				
        <div class="shop_wap1">
          <div class="shop_wap1_text"> 支付方式</div>
          <div class="shop_wap1_text_main">
            <input type="hidden" name="payselect" value="" />
            <ul class="paway_select" id="payway">
              <?php if(is_array($payway)): $k = 0; $__LIST__ = $payway;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$payway): $mod = ($k % 2 );++$k;?><li <?php if($k == 1): ?>class="ative"<?php endif; ?> data-id="<?php echo ($payway['payway_id']); ?>"><?php echo ($payway['payway_name']); ?></li><?php endforeach; endif; else: echo "" ;endif; ?>
              <!--<li>自取付款</li>-->
            </ul>
            <div class="clear"></div>
          </div>
        </div>
        <div class="shop_wap1">
          <div class="shop_wap1_text"> 配送方式</div>
          <div class="shop_wap1_text_main">
            <input type="hidden" name="sendselect" value="" />
            <ul class="paway_select" id="sendway">
              <?php if(is_array($sendway)): $k = 0; $__LIST__ = $sendway;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$sendway): $mod = ($k % 2 );++$k;?><li <?php if($k == 1): ?>class="ative"<?php endif; ?> data-id="1"><?php echo ($sendway['sendway_name']); ?></li><?php endforeach; endif; else: echo "" ;endif; ?>
              
              
            </ul>
            <div class="clear"></div>
          </div>
        </div>
        <div class="shop_wap1">
          <div class="shop_wap1_text"> 送货清单</div>
          <div class="shop_wap1_text_main"> 
          <table class="shop_wrap">
            <tr class="shop_wrap_line1">
              <td >
                商品ID</td>
              <td colspan="2">商品</td>
              <td>单价（元）</td>
              <td>数量</td>
              </tr>
            <?php if(is_array($order_good)): $k = 0; $__LIST__ = $order_good;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$cartshop): $mod = ($k % 2 );++$k;?><tr class="shop_wrap_line2">
                <td align="center" width="100px"><input type="hidden" class="goodid"  value="<?php echo ($cartshop['id']); ?>"/>
                  <?php echo ($k); ?></td>
                <td width="150px"><img src="<?php echo getalbumface($cartshop['go_info']['go_pics']);?>" width="80px" height="80px" /></td>
                <td width="300px"><?php echo ($cartshop['go_name']); ?></td>
                <td width="100px"><span class="shopone_text"><?php echo ($cartshop['go_info']['go_value']); ?></span></td>
                <td width="100px"><?php echo ($cartshop['number']); ?><input type="hidden" class="goodsnum"  value="<?php echo ($cartshop['number']); ?>" /></td>
                </tr><?php endforeach; endif; else: echo "" ;endif; ?>
			    <input type="hidden" name="goodsmain" />
          </table>
		  </div>
        </div>
        <div class="shop_wap1">
          <div class="shop_wap1_text_main">
            <!-- <table width="300" border="0" cellspacing="0" cellpadding="0" class="fr">
              <tr>
                <td align="right"><span class="colorred">2</span>件商品，总金额：</td>
                <td>￥<?php echo ($pageconfig["total_value"]); ?></td>
              </tr>
              <tr>
                <td  align="right">返现：</td>
                <td>￥-0.00</td>
              </tr>
              <tr>
                <td  align="right">运费：</td>
                <td>￥0.00</td>
              </tr>
              <tr>
                <td  align="right">应付金额：</td>
                <td>￥15.00</td>
              </tr>
            </table> -->
            <div class="clear"></div>
          </div>
        </div>
		
		
        <div class="shop_wap1">
          <div class="shop_wap1_text_main fr ">
              <span class="f14">应付总额：</span><span class="f16 fwb colorred2"><b class="money">￥</b><?php echo ($pageconfig["total_value"]); ?></span>&nbsp;&nbsp;&nbsp;&nbsp;<input class="abtn3" type="submit" value="提交订单" />
          </div>
        </div>	
<!-- 		<div class="shop_wap2">
		    寄送至：<span id="address"></span><br />
			收货人：任先生 158****6673
		</div> -->	
		
      </div>
</form>	  
<!--订单块的结束-->	  
	  
    </div>
  </div>
</div>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" 
   aria-labelledby="myModalLabel" aria-hidden="true">
   <form name='address'>
   <input name="id" type="hidden" />
   <div class="modal-dialog">
      <div class="modal-content" class="adralert">
         <div class="modal-header" style="padding:5px;">
            <button type="button" class="close" 
               data-dismiss="modal" aria-hidden="true">
                  &times;
            </button>
            <h4 class="modal-title" id="myModalLabel">
                 收货地址
            </h4>
         </div>
         <div style="text-align:left;padding-left:20px;">
               <span class="line_30">收货人</span><br/>
               <input type="text" name="receiver" class="form-control adrinput1"/> 
         </div>
         <div style="text-align:left;padding-left:20px;">
                <span class="line_30">所在地区</span><br/>
                <select class="xk_address" name="province">
              </select>
              <select class="xk_address" name="city">
              </select>
              <select class="xk_address" name="area">
              </select>
         </div>
         <div style="text-align:left;padding-left:20px;">
               <span class="line_30">详细地址</span><br/>
               <input type="text" name="address_detail" class="form-control adrinput1"/> 
         </div>
         <div style="text-align:left;padding-left:20px;">
               <span class="line_30">手机号码</span><br/>
               <input type="text" name="mobile" class="form-control adrinput1"/> 
         </div>
         <div style="text-align:left;padding-left:20px;">
               <span class="line_30">邮箱</span><br/>
               <input type="text" name="email" class="form-control adrinput1"/> 
         </div>
         <div class="modal-footer">
            <button type="button" class="btn btn-default" 
               data-dismiss="modal">关闭
            </button>
            <button type="button" class="btn btn-primary" id="submit">
               保存收货地址
            </button>
         </div>
      </div><!-- /.modal-content -->
    </div>
    </form>
</div>
  <script>
      $(document).ready(function(){
        // $(document).live("change",".xk_address",function(){
        //     //alert($(this).attr("name"));
        //     alert("aaa");
        //  });
        //  
        //  
        $(".xk_address").change(function(){
            var id=$(this).val();
            var tag=$(this).attr("name");
            var url="<?php echo U('Public/get_address');?>";
            if(tag=="province"){
              address_city(url,id);
            }else if(tag=="city"){
              address_area(url,id);
            }
        });
           var address_url="<?php echo U('home/Public/get_address');?>";
           address_province(address_url);
        //表单提交 
        $("#submit").click(function(){
            var data=$("form[name='address']").serialize();
            var url="<?php echo U('User/doaddress');?>";
            $.post(url,data,function(data){
                    data=eval("("+data+")");
                    if(data['status']=="success"){
                       window.location.reload();
                    }
            });
        });



           $("#payway li").click(function(){      //支付方式的选择
           $("#payway li").removeClass("ative");
           $(this).addClass('ative'); 
           form_zip(); 
         });
           $("#sendway li").click(function(){      //配送方式的选择
           $("#sendway li").removeClass("ative");
           $(this).addClass('ative'); 
           form_zip(); 
         });
         
       
       var address=""; //定义收货地址
       var payway=$("#payway .ative").attr("data-id");  //定义支付方式
       var sendway=$("#sendway .ative").attr("data-id"); //定义配送方式
       var cartnum=$(".shop_wrap_line2").length;//获取购物车内商品数量
       var goods_order="";
       for(var i=0;i<cartnum;i++){  
           goods_order=goods_order+"@"+$(".goodid").eq(i).val()+"$"+$(".goodsnum").eq(i).val();
       }

       $("input[name='goodsmain']").val(goods_order);
       $("input[name='payselect']").val(payway);//支付方式
       $("input[name='sendselect']").val(sendway);//配送方式
       
       form_zip();
       function form_zip(){
         
         payway=$("#payway .ative").attr("data-id");
         sendway=$("#sendway .ative").attr("data-id");
         $("#address").html(address);
         $("input[name='payselect']").val(payway);//支付方式
         $("input[name='sendselect']").val(sendway);//配送方式
       }
             
             $("form[name='order']").submit(function(){
         
         if($(".detailead").val()==""){
            erralert(".detailead","请填写详细街道地址");
         }
               if($('input[name="rename"]').val()==""){
            erralert('input[name="rename"]',"请填写收货人姓名");
         }
         if($('input[name="retel"]').val()==""){
            erralert('input[name="retel"]',"请填写收货人联系电话");
         }
         if($('input[name="remail"]').val()==""){
            erralert('input[name="remail"]',"请填写收货人邮箱");
         }         
               if($(".xiakeerror").length>0){
           return false
         }
       });
       $(".detailead").change(function(){
          if($(this).val() !==""){rightalert('.detailead');}else{erralert(".detailead","请填写详细街道地址");}
       });
       $('input[name="rename"]').change(function(){
          if($(this).val() !==""){rightalert('input[name="rename"]');}else{erralert('input[name="rename"]',"请填写联系人姓名");}
       });
       $('input[name="retel"]').change(function(){
          if($(this).val() !==""){
           if(!/\d{8,12}/.test($(this).val())){
             erralert('input[name="retel"]',"请填写正确的电话号码格式");
           }else{
              rightalert('input[name="retel"]');
           }  
        }else{erralert('input[name="retel"]',"请填写联系人电话");}  
             
       });
        $('input[name="remail"]').change(function(){
          if($(this).val() !==""){
            if(!/\w+@\w+\.\w{2,5}/.test($(this).val())){
             erralert('input[name="remail"]',"请正确填写邮箱格式");
          }else{
            rightalert('input[name="remail"]');
          }
         }else{
            erralert('input[name="remail"]',"请填写联系人邮箱");
         }
       });
       
       
      });
      function erralert(yuansu,msg){   //封装验证错误验证
              $(yuansu).next().html('<b class="f20 line_20 fl colorred2 xiakeerror">&nbsp;&nbsp;×</b><span class="colorred2 fl line_20">&nbsp;&nbsp;&nbsp;'+msg+'</span>');      }
      function rightalert(yuansu,msg){   //正确验证
          $(yuansu).next().html('<b class=" fl xiakeright checkright block"></b>'); 
      }

      //function numadd()
      
    </script>
</body></html>